const path = require('path')

const isDev = process.env.NODE_ENV !== 'production'
module.exports = {
  outputDir: 'ccas-ui',
  publicPath: process.env.BASE_URL,
  productionSourceMap: isDev,
  chainWebpack: config => {
    config.plugins.delete('prefetch-index')
    config.plugins.delete('preload-index')
    const types = ['vue-modules', 'vue', 'normal-modules', 'normal']
    types.forEach(type => {
      const scssRule = config.module.rule('scss').oneOf(type)
      scssRule.use('style-resource')
        .loader('style-resources-loader')
        .options({
          patterns: [process.env.VUE_APP_THEME]
        })
    })
  },
  devServer: {
    proxy: {
      '/api': {
        // target: 'http://192.168.201.66:8003',
        // target: 'http://192.168.233.183:8003',
        // target: 'http://192.168.201.52:8003',
        // target: 'http://192.168.233.78:8003',
        target: 'https://vob.hn.10086.cn/hn_api',
        ws: true,
        changeOrigin: true,
        pathRewrite: {
          '/api': ''
        }
      }
    }
  },
  pages: {
    index: path.resolve(__dirname, './packages/app/main.js')
  }
}
